package larrys.pomodoro.form;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotBlank;

public class ActivityFormBean {
	
	public final static SimpleDateFormat ACTIVITY_FORM_PLAN_DATE_FMT = new SimpleDateFormat("yyyy-MM-dd"); 
	
	@NotBlank
	@NotNull
	private String name;

	private String description;

	@Min(0)
	private int estimation;

	@NotNull
	private String planDate;

	@Min(0)
	private int priority;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getEstimation() {
		return estimation;
	}

	public void setEstimation(int estimation) {
		this.estimation = estimation;
	}

	public String getPlanDate() {
		return planDate;
	}
	
	public Date getPlanDateByDate() throws ParseException{
		return ACTIVITY_FORM_PLAN_DATE_FMT.parse(planDate);
	}

	public void setPlanDate(String planDate) {
		this.planDate = planDate;
	}

	public int getPriority() {
		return priority;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	@Override
	public String toString() {
		return "ActivityFormBean [name=" + name + ", description="
				+ description + ", estimation=" + estimation + ", planDate="
				+ planDate + ", priority=" + priority + "]";
	}

}
